package com.ruoyi.web.controller.system;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.system.domain.GGardener;
import com.ruoyi.system.service.IGGardenerService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.GWages;
import com.ruoyi.system.service.IGWagesService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 工资信息管理Controller
 * 
 * @author nb
 * @date 2024-05-09
 */
@RestController
@RequestMapping("/system/wages")
public class GWagesController extends BaseController
{
    @Autowired
    private IGWagesService gWagesService;



    @Autowired
    private IGGardenerService gGardenerService;

    /**
     * 查询mingz列表
     */

    @GetMapping("/gzxxlist")
    public AjaxResult gzxxlist(GGardener gGardener)
    {
        //查询名字
        List<GGardener> list = gGardenerService.selectGGardenerList(gGardener);
        return success(list);
    }


    /**
     * 查询工资信息管理列表
     */
    @PreAuthorize("@ss.hasPermi('system:wages:list')")
    @GetMapping("/list")
    public TableDataInfo list(GWages gWages)
    {
        startPage();
        List<GWages> list = gWagesService.selectGWagesList(gWages);
        return getDataTable(list);
    }

    /**
     * 导出工资信息管理列表
     */
    @PreAuthorize("@ss.hasPermi('system:wages:export')")
    @Log(title = "工资信息管理", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, GWages gWages)
    {
        List<GWages> list = gWagesService.selectGWagesList(gWages);
        ExcelUtil<GWages> util = new ExcelUtil<GWages>(GWages.class);
        util.exportExcel(response, list, "工资信息管理数据");
    }

    /**
     * 获取工资信息管理详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:wages:query')")
    @GetMapping(value = "/{wid}")
    public AjaxResult getInfo(@PathVariable("wid") Long wid)
    {
        return success(gWagesService.selectGWagesByWid(wid));
    }

    /**
     * 新增工资信息管理
     */
    @PreAuthorize("@ss.hasPermi('system:wages:add')")
    @Log(title = "工资信息管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody GWages gWages)
    {
        return toAjax(gWagesService.insertGWages(gWages));
    }

    /**
     * 修改工资信息管理
     */
    @PreAuthorize("@ss.hasPermi('system:wages:edit')")
    @Log(title = "工资信息管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody GWages gWages)
    {
        return toAjax(gWagesService.updateGWages(gWages));
    }

    /**
     * 删除工资信息管理
     */
    @PreAuthorize("@ss.hasPermi('system:wages:remove')")
    @Log(title = "工资信息管理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{wids}")
    public AjaxResult remove(@PathVariable Long[] wids)
    {
        return toAjax(gWagesService.deleteGWagesByWids(wids));
    }
}
